<template>
  <div class="example">
    <transition name="fade">
      <div v-if="isShow">hello world</div>
      <div v-else>bye world</div>
    </transition>
    <div class="btn">
      <button @click="handleClick">{{ isShow ? '隐藏' : '显示' }}</button>
    </div>
  </div>
</template>

<script>
/**
 * 例子 - 多个元素过渡（无效）
 */

export default {
  data() {
    return {
      isShow: true
    }
  },
  methods: {
    handleClick() {
      this.isShow = !this.isShow;
    }
  }
}
</script>

<style lang="less" scoped>
.fade-enter,
.fade-leave-to {
    opacity: 0;
}
.fade-enter-active,
.fade-leave-active{
    transition: opacity 3s;
}
</style>
